#ifndef VECTOR_H
#define VECTOR_H

#include <math.h>
#include <stdio.h>
#include "defaultsetting.h"


class Vector4
{
  public:
    Vector4();
    Vector4(const REAL ax,const REAL ay,const REAL az,const REAL aw);
    Vector4(const Vector4 &v);

    REAL getX()const;
    REAL getY()const;
    REAL getZ()const;
    REAL getW()const;

    REAL getModule()const;

    void set(const REAL ax,const REAL ay,const REAL az,const REAL aw);
    void setX(const REAL ax);
    void setY(const REAL ay);
    void setZ(const REAL az);
    void setW(const REAL aw);
    
    /**
      * Modify the vector module
      */
    void setModule(const REAL m);

    Vector4 operator+(const Vector4 &v)const;
    Vector4 operator-(const Vector4 &v)const;
    Vector4 operator*(const REAL k)const;
    bool operator==(const Vector4 &v)const;
    bool operator!=(const Vector4 &v)const;
    Vector4 operator-()const;

    void print()const;

  private:
    REAL m_x,m_y,m_z,m_w;
};

/**
  * Add vector a and b.
  * @returns A vector with the result of the operation.
  */
Vector4 add(const Vector4 &a,const Vector4 &b);

/**
  * Subtract vector a and b.
  * @returns A vector with the result of the operation.
  */
Vector4 sub(const Vector4 &a,const Vector4 &b);

/**
  * Makes the scalar product of vector a and b.
  * @returns The number the result of the operation.
  */
REAL dotProduct(const Vector4 &a,const Vector4 &b);

/**
  * Makes the vectorial product of vector a and b.
  * @returns The vector result of the operation.
  */
Vector4 crossProduct(const Vector4 &a,const Vector4 &b,const Vector4 &c);

/**
  * Make the scalar product of vector v with the k number.
  * @returns A vector with the result of the operation.
  */
Vector4 multiply(const Vector4 &v,const REAL &k);

/**
  * Make the scalar product of vector v with the k number.
  * @returns A vector with the result of the operation.
  */
Vector4 multiply(const REAL &k,const Vector4 &v);

/**
  * @returns A vector with the same direction of v but with module is one.
  */
Vector4 normalize(const Vector4 &v);

/**
  * @returns A vector with v's module but its opossite direction.
  */
Vector4 reverse(const Vector4 &v);


#endif
